package cn.mldn.mldncloud.consumer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.mldn.mldncloud.service.ICOrdersService;

@RestController 								// 为方便起见使用Restful风格展示
@CrossOrigin
public class OrdersController {
	@Autowired
	private ICOrdersService service ;			// 注入远程业务接口对象
	
	@GetMapping("/consumer/orders/list")
	public Object listOrdersRest(String refectoryId) {
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		this.service.listOrders(refectoryId);
		return this.service.listOrders(refectoryId);		// 调用Restful业务方法
	}
	@GetMapping("/consumer/orders/listToday")
	public Object listTodayOrdersRest(String refectoryId) {
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		this.service.listTodayOrders(refectoryId);
		return this.service.listOrders(refectoryId);		// 调用Restful业务方法
	}
	@GetMapping("/consumer/orders/listTodayPage")
	public Object listTodayOrdersPageRest(String refectoryId,int page,int size) {
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		this.service.listTodayOrders(refectoryId);
		return this.service.listTodayOrdersPage(refectoryId,page,size);		// 调用Restful业务方法
	}
	@GetMapping("/consumer/orders/listPage")
	public Object listOrdersPageRest(String refectoryId,int page,int size) {
		System.err.println(page);
		System.err.println(size);
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		System.err.println(refectoryId);
		this.service.listTodayOrders(refectoryId);
		return this.service.listOrdersPage(refectoryId,page,size);		// 调用Restful业务方法
	}
}
